using System;
using System.Collections;

namespace ClickSocial.Framework
{
	/// <summary>
	/// ArqException base class for all Arq Application Exceptions
	/// </summary>
    /// <remarks>
    /// Any thrown Exception from a Arq app must inherits from ArqException
    /// </remarks>
	public class ArqException : ApplicationException
	{
		#region Private instance members
		private Guid      _trackingId     = Guid.NewGuid();
		private Hashtable _additionalInfo = null;
        private bool      _alreadyLogged  = false;
		#endregion Private instance members

		#region Constructor

        /// <summary>
        /// Creates a new instance of the ArqException class
		/// </summary>
		/// <param name="message">Message explaining the reason for the exception</param>
		/// <param name="innerException">Original exception</param>
		public ArqException(string message, Exception innerException) : base(message, innerException)
		{
		}

		/// <summary>
        /// Creates a new instance of the ArqException class
		/// </summary>
        /// <param name="message">Message explaining the reason for the exception</param>
        public ArqException( string message )
            : base( message )
		{
		}
		
		#endregion Constructor

		#region Public properties
		/// <summary>
		/// Gets the hashtable containing additional user define information
		/// </summary>
        /// <remarks>
        /// Useful for logging parameter values or variable state during a method
        /// </remarks>
		public Hashtable AdditionalInfo
		{
			get { return _additionalInfo; }
		}

		/// <summary>
		/// Gets the unique identification of this exception
		/// </summary>
        /// <remarks>
        /// Useful for tracking errors reported by users with logged exceptions
        /// </remarks>
		public string TrackingId
		{
			get { return _trackingId.ToString(); }
		}
		#endregion Public properties

		#region Internal methods
		/// <summary>
		/// Sets the AdditionalInfo property
		/// This property can be only changed into the framework
		/// </summary>
		internal void SetAdditionalInfo(Hashtable value)
		{
			_additionalInfo = value;
		}

        internal bool AlreadyLogged
        {
            get { return _alreadyLogged; }
            set { _alreadyLogged = value; }
        }

		#endregion Internal methods

    }
}
